<template>
  <div v-hide>
    <div :class="['top', white ? 'whi' : '']">
      <div class="backboxs" @click="goesBack">
        <i :class="['imgIcon', goes ? 'imgs1' : 'imgs2']"></i>
        <span class="back" :style="goes ? '' : 'color:#fff'">返回</span>
      </div>
    </div>
  </div>
</template>

<script>
import ls from 'store2'
export default {
  props: {
    white: {
      type: Boolean,
      default: false,
    },
    goes: {
      type: Boolean,
      default: true,
    },
    aa: String,
    bb: String,
  },
  data() {
    return {}
  },
  computed: {},
  destroyed() {},
  mounted: function() {},
  methods: {
    goesBack() {
      if (this.aa) {
        this.fun()
      } else {
        this.$router.back()
      }
    },
    fun() {
      this.$router.replace({
        path: this.aa,
        query: {
          type: this.bb,
        },
      })
    },
  },
}
</script>

<style scoped lang="less">
.top {
  width: 7.5rem;
  height: 0.8rem;
  line-height: 0.8rem;
  padding: 0.2rem 0.3rem;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  .backboxs {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 3rem;
    height: 0.8rem;
    padding: 0.2rem 0;
  }
  .imgIcon {
    width: 0.4rem;
    height: 0.4rem;
    vertical-align: middle;
  }
  .imgs1 {
    background: url('~@/static/sprite/icon_sprites_40.png') -0.1rem -0.1rem;
    background-size: 3rem 2.4rem;
  }
  .imgs2 {
    background: url('~@/static/sprite/icon_sprites_40.png') -0.7rem -0.1rem;
    background-size: 3rem 2.4rem;
  }

  .back {
    display: inline-block;
    margin-left: 0.1rem;
    font-weight: bold;
    color: #222;
    vertical-align: middle;
  }
}

.whi {
  background: #fff;
}
</style>
